﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace MyMusicPlay._4._0
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            this.DispatcherUnhandledException += App_DispatcherUnhandledException;
        }


        private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {
            try
            {
                Log.Write(e?.Exception.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show("【UI线程主线程异常】记录异常的时候" + ex?.ToString() ?? "");
            }
            finally
            {
                e.Handled = true;
            }
        }
    }
}
